var url="/tbpoject/count/"
var path="/tbpoject/user/"	
$(function(){
	init();
	getNewUser();
	getNewStore();
	index();
})
function index(){
	$("#business").click(function(){
		location.href="/tbpoject/background/storemanager/store.jsp";
	})
	
	$("#users").click(function(){
		location.href="/tbpoject/background/usermanager/userManager.jsp";
	})
	
	$("#shopStore").click(function(){
		location.href="/tbpoject/background/storemanager/store.jsp";
	})
	
	$("#images").click(function(){
		location.href="/tbpoject/background/navgation/navPicture.jsp"
	})
}
function init(){
	var shop=$("#shop");
	var store=$("#store");
	var user=$("#user");
	var imgages=$("#img");
	$.post(url+"sum",function(data){
		var item =$.parseJSON(data);
		shop.html(item.business)
		store.html(item.store)
		user.html(item.user)
		imgages.html(item.image);
	})
}
function getNewUser(){
	
	$.ajax({type:"post",
			url:path+"getNewUser",
			async:false,
			success:function(data){
				var utobdy=$("#utbody");
				utobdy.html("");
				var item =$.parseJSON(data);
				for(var i=0;i<item.length;i++){
					utobdy.append("<tr>"
		              +'<td><p><i class="im-user4"></i>'+item[i].name+'</p></td>'
		              +"<td>"
		              + "<p>"+item[i].sex+"</p>"
		              +"</td>"
		              +"<td><p>"+item[i].time+"</p>"
		              +"</td>"
		              +"</tr>")
				}
			}
	})
}

	function getNewStore(){
		$.ajax({type:"post",
				url:path+"getNewStore",
				async:false,
				success:function(data){
					var stobdy=$("#stbody");
					stobdy.html("");
					var item =$.parseJSON(data);
					for(var i=0;i<item.length;i++){
						stobdy.append("<tr>"
			              +'<td><p><i class="im-user4"></i>'+item[i].name+'</p></td>'
			              +"<td>"
			              + "<p>"+item[i].sex+"</p>"
			              +"</td>"
			              +"<td><p>"+item[i].time+"</p>"
			              +"</td>"
			              +"</tr>")
					}
				}	
		})
	}